#ifndef HISTOGRAMWIDGET_H
#define HISTOGRAMWIDGET_H

#include <QWidget>
#include <QMap>

class HistogramWidget : public QWidget
{
	Q_OBJECT
public:
	explicit HistogramWidget(QWidget *parent = 0);

public slots:
	void SlotSetHistogramData(const QMap<int, int> &data);

protected:
	void paintEvent(QPaintEvent *event);
	void mouseMoveEvent(QMouseEvent *event);
	void leaveEvent(QEvent *event);

private:
	void calcMinMax();
	void drawHistogram(QPainter &painter, QRectF rect);

private:
	QMap<int, int> m_data;
	int m_iValueMin;
	int m_iValueMax;
	int m_iRangeMin;
	int m_iRangeMax;
	QPoint m_ptMouse;
};

#endif // HISTOGRAMWIDGET_H
